#ifndef ALSATY_H
#define ALSATY_H

#include <QDebug>
#include <QMutex>
#include <QThread>
#include <QUdpSocket>

#include <alsa/asoundlib.h>

class ReadAudioThread : public QThread
{
    Q_OBJECT
private:
    QMutex        m_lock;
    volatile bool m_stop;

public:
    void run();

    void WorkThread();
    void stop();
};

// class WriteAudioThread : public QThread
//{
//    Q_OBJECT
// private:
//    volatile bool m_stop;
//    QMutex        m_lock;

// public:
//    void stop();
//    void WorkThread();

//    void run();

// signals:
//    void alsaErrLog(QString addr);
//};

// int set_hwparams(snd_pcm_t *handle, snd_pcm_hw_params_t *params, unsigned int channels, unsigned int rate, snd_pcm_uframes_t &buffer_size,
//                 snd_pcm_uframes_t &period_size);
// int set_swparams(snd_pcm_t *handle, snd_pcm_sw_params_t *swparams, snd_pcm_uframes_t &buffer_size, snd_pcm_uframes_t &period_size);
// int xrun_recovery(snd_pcm_t *handle, int err);

#endif
